package com.gzhryc.pay.models;

import org.apache.commons.lang3.time.DateUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 租借订单参数
 * 
 * @author zhanghao
 *
 */
public class RentBillParam implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private String deviceSn;		//设备序列号
	private Integer depositMoney;	//押金
	private Integer dayMaxMoney;	//每天封顶费用
	private String rentTimeUnit; 	//租借时间的单位
	private Long rentTimes; 	 	//租借时间
	private Integer rentFee; 	 	//租借费用
	private String rentAddress;  	//租借地址
	private Long freeTimes;			//免费时长
	private Date stareDate;			//开始时间
	private Integer validDay;		//有效时长，单位：天

	private String describe;		//收费描述

	public String getDeviceSn() {
		return deviceSn;
	}

	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}

	public Integer getDepositMoney() {
		return depositMoney;
	}

	public void setDepositMoney(Integer depositMoney) {
		this.depositMoney = depositMoney;
	}

	public Integer getDayMaxMoney() {
		return dayMaxMoney;
	}

	public void setDayMaxMoney(Integer dayMaxMoney) {
		this.dayMaxMoney = dayMaxMoney;
	}

	public Long getFreeTimes() {
		return freeTimes;
	}

	public void setFreeTimes(Long freeTimes) {
		this.freeTimes = freeTimes;
	}

	public String getRentTimeUnit() {
		return rentTimeUnit;
	}

	public void setRentTimeUnit(String rentTimeUnit) {
		this.rentTimeUnit = rentTimeUnit;
	}

	public Long getRentTimes() {
		return rentTimes;
	}

	public void setRentTimes(Long rentTimes) {
		this.rentTimes = rentTimes;
	}

	public Integer getRentFee() {
		return rentFee;
	}

	public void setRentFee(Integer rentFee) {
		this.rentFee = rentFee;
	}

	public String getRentAddress() {
		return rentAddress;
	}

	public void setRentAddress(String rentAddress) {
		this.rentAddress = rentAddress;
	}

	public Integer getValidDay() {
		return validDay;
	}

	public void setValidDay(Integer validDay) {
		this.validDay = validDay;
	}

	public Date getStareDate() {
		return stareDate;
	}

	public void setStareDate(Date stareDate) {
		this.stareDate = stareDate;
	}

	public Date getEndDate() {
		Integer day = (depositMoney / dayMaxMoney + 1);
		if(this.stareDate == null) {
			this.stareDate = new Date();
		}
		return DateUtils.addDays(this.stareDate, day);
	}

	public String getDescribe() {
		return describe;
	}

	public void setDescribe(String describe) {
		this.describe = describe;
	}
}
